import { create } from 'zustand'

import type { MenuTheme } from 'antd';

interface ThemeState {
  theme: MenuTheme
  changeTheme: (by: MenuTheme) => void
}

const useThemeStore = create<ThemeState>()((set) => ({
    theme: localStorage.getItem('themeMode') == 'dark' ? 'dark' : 'light',
    changeTheme: (by) => set(() => {
        localStorage.setItem('themeMode', by)
        return {
            theme: by
        }
    }),
}))

export {
    useThemeStore
}

